package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.mapper.DtsGoodsAttributeMapper;
import com.qf.pojo.DtsGoodsAttribute;
import com.qf.service.DtsGoodsAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class DtsGoodsAttributeServiceImpl implements DtsGoodsAttributeService {

    @Autowired
    DtsGoodsAttributeMapper attributeMapper;
    @Override
    public void insert(DtsGoodsAttribute attribute) {
        attribute.setAddTime(new Date());
        attribute.setUpdateTime(new Date());
        attribute.setDeleted(false);

        attributeMapper.insert(attribute);
    }

    @Override
    public void deleteById(Integer id) {
        LambdaQueryWrapper<DtsGoodsAttribute> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(DtsGoodsAttribute::getGoodsId,id);
        attributeMapper.delete(wrapper);
    }
}
